import { ref } from 'vue'
import type { LiquidityData, SpreadData } from '../types'
import { useChartData } from './useChartData'

export function useLiquidityData() {
  const { generatePercentageData } = useChartData()

  const mockConfig = {
    startDate: '2007-07-02',
    endDate: '2023-06-30',
    dataPoints: 200
  }

  const liquidityData = ref<LiquidityData>({
    excessReserveRatio: {
      name: '超额存款准备金利率',
      data: generatePercentageData(mockConfig),
      color: '#3B82F6'
    },
    dr007: {
      name: '加权利率DR007',
      data: generatePercentageData(mockConfig),
      color: '#F59E0B'
    },
    governmentBond1Y: {
      name: '中债国债到期利率1年',
      data: generatePercentageData(mockConfig),
      color: '#10B981'
    },
    shibor6Y: {
      name: 'SHIBOR6年',
      data: generatePercentageData(mockConfig),
      color: '#8B5CF6'
    },
    lpr1Y: {
      name: 'LPR1年',
      data: generatePercentageData(mockConfig),
      color: '#EF4444'
    }
  })

  const spreadData = ref<SpreadData>({
    corporateBondAAvsAAA: {
      name: '中债企业债(AA+)与企业债(AAA)利差3年',
      data: generatePercentageData(mockConfig),
      color: '#3B82F6'
    },
    corporateBondAAvsGov: {
      name: '中企业债(AA)与国利差3年',
      data: generatePercentageData(mockConfig),
      color: '#F59E0B'
    },
    urbanInvestmentAAvsAAA: {
      name: '中城投债(AA+)与城投债(AAA)利差3年',
      data: generatePercentageData(mockConfig),
      color: '#10B981'
    }
  })

  return {
    liquidityData,
    spreadData
  }
}
